package news.dao;

import news.model.Admin;
import news.model.CommonResult;
import news.model.Role;
import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Repository;

import java.util.List;


public interface AdminDao {

    List<Admin> adminList(Admin admin);

    @Select("select id,name from role")
    List<Role> roles();

    void save(Admin admin);


    @Insert("insert into admin_role(admin_id,role_id)value(#{adminId},#{roleId})")
    void saveAdminRole(@Param("roleId") Integer roleId,@Param("adminId") Integer id);


    @Delete("delete from admin where id = #{id}")
    void deleteAdmin(Integer id);

    @Delete("delete from admin_role where admin_id = #{id}")
    void deleteAdminRole(Integer id);

    Admin findAdminById(Integer id);

    void update(Admin admin);

    @Update("")
    void changePwd(String s);
}
